package com.zx.mes.feign.hyl.feign;


import com.zx.mes.feign.hyl.feign.impl.RedisWeatherClientFallbackFactory;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 天气数据redis缓存接口feign
 * @author hyl
 * @date 2018-3-2
 */
@FeignClient(name = "yun-redis",fallbackFactory = RedisWeatherClientFallbackFactory.class)
public interface RedisWeatherClient {

    /**
     * 设置天气缓存 (redis)
     * @param key key
     * @param jsonStr jsonStr
     * @return string
     */
    @RequestMapping(method = RequestMethod.POST,value = "/weather/setCache")
    String setWeatherCache(@RequestParam("key") String key,@RequestParam("jsonStr") String jsonStr);

    /**
     * 获得天气缓存 (redis)
     * @param key key
     * @return hyl(则没有找到缓存,其它值则代表有返回)
     */
    @RequestMapping(method = RequestMethod.GET,value = "/weather/getCache")
    String getWeatherCache(@RequestParam("key") String key);
}
